package kliment.math {
	
	public class ColorSpaceMath {
		
		public static function scientificToArtisticSmooth(scientific:Number):Number {
            if (scientific < 35)
                return scientific * (60 / 35);
            if (scientific < 60)
                return Calc.mapRange(scientific, 35, 60, 60, 122);
            if (scientific < 120)
                return Calc.mapRange(scientific, 60, 120, 122, 165);
            if (scientific < 180)
                return Calc.mapRange(scientific, 120, 180, 165, 218);
            if (scientific < 240)
                return Calc.mapRange(scientific, 180, 240, 218, 275);
            if (scientific < 300)
                return Calc.mapRange(scientific, 240, 300, 275, 330);
            return Calc.mapRange(scientific, 300, 360, 330, 360);
        }

        public static function artisticToScientificSmooth(artistic:Number):Number {
            if (artistic < 60)
                return artistic * (35 / 60);
            if (artistic < 122)
                return Calc.mapRange(artistic, 60, 122, 35, 60);
            if (artistic < 165)
                return Calc.mapRange(artistic, 122, 165, 60, 120);
            if (artistic < 218)
                return Calc.mapRange(artistic, 165, 218, 120, 180);
            if (artistic < 275)
                return Calc.mapRange(artistic, 218, 275, 180, 240);
            if (artistic < 330)
                return Calc.mapRange(artistic, 275, 330, 240, 300);
            return Calc.mapRange(artistic, 330, 360, 300, 360);
        }

	}
}